﻿<?php
//$tid 栏目号
//$oname 分类名称
//ovalue 分类值
//hot = 1 热门文章
//showart = 1 直接显示栏目中的文章
//131-219-220-221-222-223-224-225
require_once("include/common.inc.php");
require_once("include/dedesql.class.php");
require_once("dede/common/common_parameters.php");
require_once(DEDEINC.'/datalistcp.class.php');

$title = '法治天下 - 文章列表';
require_once('common/header.php');

$tid = intval($_GET["tid"]);
$showart = intval($_GET["showart"]);
$oname = intval($_GET["oname"]);
$ovalue = intval($_GET["ovalue"]);
$hot = intval($_GET["hot"]);

if($tid == 0){
	echo 'ERROR';
	exit;
}

//得到所属栏目
$tmp = $dsql->GetOne("select * from cms_arctype where id = '".$tid."' limit 1");
$topicTopid = $tmp['topid'];
$topicTitle = $tmp['typename'];


$tmp2 = $dsql->GetOne("select * from cms_arctype where id = '".$topicTopid."' limit 1");

if(trim($tmp2['typename']) != ""){
	switch($tmp2['typename']){
		case "新闻时讯":
			$url = "/news.php";
			break;
		case "考研天地":
			$url = "/exam.php";
			break;
		case "在职硕博":
			$url = "/on-job.php";
			break;
		case "法务培训":
			$url = "/trainings.php";
			break;
		case "合同范本":
			$url = "/contract.php";
			break;
		case "商事仲裁":
			$url = "/business-arbitration.php";
			break;
		case "国际法院":
			$url = "/court.php";
			break;
		case "WTO":
			$url = "/wto.php";
			break;
		case "法律英语":
			$url = "/english.php";
			break;
		case "法学百科":
			$url = "/encyclopaedia.php";
			break;
		case "法律法规":
			$url = "/law.php";
			break;
		case "法律辞典":
			$url = "/law-dictionary.php";
			break;
		case "司法案例":
			$url = "/case.php";
			break;
		case "公检法司":
			$url = "/gjsf.php";
			break;
		case "法律学人":
			$url = "/lawyer.php";
			break;
		case "法律论文":
			$url = "/paper.php";
			break;
		case "实习就业":
			$url = "/job.php";
			break;
		case "律师营销":
			$url = "/law-business.php";
			break;
		case "法律院校":
			$url = "school.php";
			break;
		default:
			$url = "";
			break;
	}

	if($url != "")
		$path1 = " >> <a href=\"".$url."\" target=\"_blank\" style=\"color:#2263AC\">" . $tmp2['typename'] . "</a>";
}
if(trim($tmp['typename']) != ""){
	$path2 = " >> <a href=\"/content-list.php?tid=".$tid."\" target=\"_blank\" style=\"color:#2263AC\">" . $tmp['typename'] . "</a>";
}

?>
<style>
.titbox {
height: 42px;
padding-top: 20px;
padding-left: 0px;
line-height: 29px;
font-size: 16px;
}
.pub_time {
color: #9C9C9C;
}
</style>
<div class="index_box clearfix">
	<div class="left_info">
<!--- 法治时评  start------>
		<div class="cn_box01" style="height:830px">
			<div class="" style="text-align:left;font-size:14px;margin-top:10px;margin-left:10px;">
				<a href="/index.php" style="color:#2263AC">法治天下</a> <?=$path1?> <?=$path2?>
			</div>
			<div class="titbox"><strong><?=$topicTitle?></strong></div>
			<ul class="one_row_box031">
				<li style="line-height: 24px;color: #0B3B8D;">
					<?php
						if($oname > 0 && $ovalue > 0){
							$sql1 = " ,article_options_mapping b ";
							$sql2 = " and b.option_keyname = '".str_replace('[]', '', $paramArray[$oname]['checkboxName'])."' and b.option_value = '".$ovalue."' and a.id=b.article_id";
						}
						
						if($hot == 1){
							$sql3 = " and a.flag = 'c' ";
						}
						$sql = "select * from cms_archives a $sql1 where a.typeid = '".$tid."' $sql2 $sql3 ";
						$sql.= " order by a.id desc";
						//$dsql->SetQuery($sql);
						//$dsql->Execute();
						
						$dlist = new DataListCP();
						
						$dlist->pageSize = 30;
						$dlist->SetParameter('tid', $tid);
						
						if($oname > 0 && $ovalue > 0){
							$dlist->SetParameter('oname', $oname);
							$dlist->SetParameter('ovalue', $ovalue);
						}
						
						if($hot == 1){
							$dlist->SetParameter('hot', $hot);
						}
						
						$dlist->SetSource($sql);
						$dlist->PreLoad();
						$list = $dlist->GetArcList();
						$page = $dlist->GetPageList();
						$i = 0;
						foreach($list as $row)
						{
							//处理直接显示文章的栏目
							if($i == 0 && $showart == 1){
								echo "<script>location.href='info.php?id=".$row['id']."';</script>";
								exit;
							}
							echo "<a href=\"./info.php?id=".$row['id']."\" target=\"_blank\" style=\"width:530px\">".$row["title"]."</a><a class='date'>".date("Y-m-d", $row['senddate'])."</a>";
							$i++;
						}
						
						if($i == 0){
							echo "当前栏目尚未存在文章.";
						}
						
						
					?>
				</li>
			</ul>
		</div>
		
		<table cellspacing="1" cellpadding="2" border="0" bgcolor="#CFCFCF" width="100%" align="center" style="margin-top:8px">
			<tr bgcolor="#F9FCEF" align="right">
				<td height="36" align="center" colspan="10">
				<?php
					echo $page;
				?>
				</td>
			</tr>
		</table>
<!--- end------>
		<div class="height_3"></div>
	</div>
	<div class="right_info">
		<?php
		require_once('common/right.php');
		?>
	</div>
</div>
<?php
require_once('common/footer.php');
?>